import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
import TreeTable from 'vue-table-with-tree-grid'
// import '../src/components/order/citydata'
Vue.prototype.$http = axios
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
axios.interceptors.request.use(config => {
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
Vue.config.productionTip = false
Vue.component('tree-table', TreeTable)
Vue.filter('dateFormat', function(originVal) {
  var dt = new Date(originVal)
  var y = dt.getFullYear()
  var m = dt.getMonth() + 1
  m = m < 10 ? '0' + m : m
  var d = dt.getDate()
  d = d < 10 ? '0' + d : d
  var hh = dt.getHours()
  hh = hh < 10 ? '0' + hh : hh
  var mm = dt.getMinutes()
  mm = mm < 10 ? '0' + mm : mm
  var ss = dt.getSeconds()
  ss = ss < 10 ? '0' + ss : ss
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
